<template>
	<view class="block">
		<view class="address-line">
			<view class="address" style="flex: 1;">{{addressName}}</view>
			<!-- <text class="iconfont icon-right"></text> -->
			<view class="scode" @click="scon">
				<view class="iconfont icon-saoma"></view>
				<!-- <image src="https://bkjz.baoliy168.com/public/static/img/saoyisao.png" style="width: 25px;height: 25px;"></image> -->
			</view>
		</view>
		<view class="search-line" @click="nav('/otherpages/goods/search/search')">
			<view class="input">
				<text class="search">搜索商品名称</text>
				<view class="btn">搜索</view>
			</view>
		</view>
		<!-- <view class="nav-line">
			<view class="nav">
				<text class="iconfont icon-shop"></text>
				<text class="text">供应商专区</text>
			</view>
			<view class="nav">
				<text class="iconfont icon-brand"></text>
				<text class="text">品牌专区</text>
			</view>
			<view class="nav">
				<text class="iconfont icon-hot"></text>
				<text class="text">名优特产</text>
			</view>
			<view class="nav">
				<text class="iconfont icon-around"></text>
				<text class="text">本地服务</text>
			</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		props: {
			addressName: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
				
			}
		},
		onLoad() {
		},
		methods: {
			nav(url) {
				this.$util.redirectTo(url)
			},
			scon(){
				uni.scanCode({
					success: function (res) {
						console.log(res)
						if(res.path){
							var id;
							var sceneParams = res.path.split('?');
							if (sceneParams.length) {
								sceneParams.forEach(item => {
									if (item.indexOf('id') != -1) id = item.split('-')[1];
									
								});
								console.log(id)
								console.log(sceneParams[0])
								var url = '/'+sceneParams[0]+'?id='+id;
								console.log(url)
								uni.navigateTo({
									url:url
								})
							}
						}
						console.log('条码类型：' + res.path);
						console.log('条码内容：' + res.result);
					}
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	.block {
		background-color: #ffd003;
		padding: 30upx 30upx 10upx 30upx;
		margin-bottom: 30upx;
		.address-line {
			display: flex;
			flex-direction: row;
			justify-content: flex-start;
			align-items: center;
			font-weight: 600;
			.address {
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				align-items: center;
				font-size: 28upx;
			}
			.icon-right {
				font-size: 22upx;
				margin-left: 10upx;
			}
			
		}
		.search-line {
			display: flex;
			flex-direction: row;
			justify-content: center;
			align-items: center;
			.input {
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;
				width: 100%;
				padding: 10upx;
				background-color: #ffffff;
				border-radius: 200upx;
				margin: 20upx 0;
				.search {
					font-size: 26upx;
					padding: 10upx 10upx 10upx 20upx;
					border-radius: 200upx;
					font-weight: 600;
				}
				.btn {
					display: flex;
					flex-direction: row;
					justify-content: center;
					align-items: center;
					font-size: 22upx;
					background-color: #fedb21;
					color: #333;
					font-weight: 600;
					padding: 10upx 20upx;
					border-radius: 200upx;
				}
			}
		}
		.nav-line {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;
			padding: 20upx;
			.nav {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				.iconfont {
					font-size: 52upx;
				}
				.text {
					font-size: 20upx;
					margin: 10upx 0;
				}
			}
		}
	}
</style>
